package tech.aistar.day08;

import java.math.BigInteger;

/**
 * 本类用来演示: 求阶乘
 *
 * @author: success
 * @date: 2022/7/27 9:06 上午
 */
public class BigIntegerDemo {
    public static void main(String[] args) {
        System.out.println(jie(6));//720
    }

    public static BigInteger jie(int n){
        //1. 指定出口
        if(n==1)
            return BigInteger.ONE;
        //2. 递归调用自己
        // int->BigInteger
        BigInteger b = new BigInteger(String.valueOf(n));
        return b.multiply(jie(n-1)); // n*jie(n-1);
    }
}
